<?php

namespace App\Http\Controllers\admin;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;

class EvaluateController extends Controller
{
    /**
    *   用户对已购买商品的评价
    */
    public function getIndex(Request $request)
    {
        // 接受搜索的关键字
        $search = $request -> input('search','');

        // 接受每页显示的条数
        $count = $request -> input('count',10); 

        // 获取店铺审核表(evaluate)里面的数据信息
        $data = DB::table('evaluate') -> where('gid','like','%'.$search.'%')-> paginate($count);

        return view('admin.evaluate.index',['data'=>$data,'request'=>$request -> all()]);
    }

    /**
    *   用户对商品评价详细信息显示
    */
    public function getInformation($id)
    {
        // 查询审核表(examine)里面对应id一条数据
        $data = DB::table('evaluate') -> where('id','=',$id) -> first();
        return view('admin.evaluate.information',['data'=>$data]);  
    }

}
